package com.universe.demo.springboot.jsonp;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SampleController {

    @GetMapping("/api/data")
    public Data getData() {
        return new Data("example", 123);
    }

    public static class Data {
        private String name;
        private int value;

        public Data(String name, int value) {
            this.name = name;
            this.value = value;
        }

        // getters and setters

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getValue() {
            return value;
        }

        public void setValue(int value) {
            this.value = value;
        }
    }
}
